package com.itheima.day04;

import java.util.Scanner;

public class Test04 {
    public static void main(String[] args) {
        //1.创建键盘录入对象
        Scanner sc = new Scanner(System.in);
        //2.定义一个求和变量
        int sum = 0;
        //3.定义一个初始化数组
        int[] arr = new int[5];
        //4.将键盘录入的值赋给数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个整数");
            arr[i] = sc.nextInt();
        }
        //5.遍历数组并求和
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        //6.输出总和
        System.out.println("sum:" + sum);













    }
}
